# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.BigtableAdmin.V2.Model.HotTablet do
  @moduledoc """
  A tablet is a defined by a start and end key and is explained in https://cloud.google.com/bigtable/docs/overview#architecture and https://cloud.google.com/bigtable/docs/performance#optimization. A Hot tablet is a tablet that exhibits high average cpu usage during the time interval from start time to end time.

  ## Attributes

  *   `endKey` (*type:* `String.t`, *default:* `nil`) - Tablet End Key (inclusive).
  *   `endTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The end time of the hot tablet.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The unique name of the hot tablet. Values are of the form `projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/[a-zA-Z0-9_-]*`.
  *   `nodeCpuUsagePercent` (*type:* `number()`, *default:* `nil`) - Output only. The average CPU usage spent by a node on this tablet over the start_time to end_time time range. The percentage is the amount of CPU used by the node to serve the tablet, from 0% (tablet was not interacted with) to 100% (the node spent all cycles serving the hot tablet).
  *   `startKey` (*type:* `String.t`, *default:* `nil`) - Tablet Start Key (inclusive).
  *   `startTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The start time of the hot tablet.
  *   `tableName` (*type:* `String.t`, *default:* `nil`) - Name of the table that contains the tablet. Values are of the form `projects/{project}/instances/{instance}/tables/_a-zA-Z0-9*`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :endKey => String.t() | nil,
          :endTime => DateTime.t() | nil,
          :name => String.t() | nil,
          :nodeCpuUsagePercent => number() | nil,
          :startKey => String.t() | nil,
          :startTime => DateTime.t() | nil,
          :tableName => String.t() | nil
        }

  field(:endKey)
  field(:endTime, as: DateTime)
  field(:name)
  field(:nodeCpuUsagePercent)
  field(:startKey)
  field(:startTime, as: DateTime)
  field(:tableName)
end

defimpl Poison.Decoder, for: GoogleApi.BigtableAdmin.V2.Model.HotTablet do
  def decode(value, options) do
    GoogleApi.BigtableAdmin.V2.Model.HotTablet.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.BigtableAdmin.V2.Model.HotTablet do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
